import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import axios from 'axios'
//axios.defaults.baseURL = 'http://10.223.8.15:8000'
axios.defaults.baseURL = 'http://113.44.151.225:8000'
// 引入echarts
import Echarts from 'vue-echarts'
import * as echarts from 'echarts'
// 使用百度地图插件
import BaiduMap from "vue-baidu-map-3x"
const app = createApp(App)

//axios拦截器
axios.interceptors.request.use(config => {
  //Token
  if (localStorage.Tokens) {
    config.headers.Authorization = "Bearer " + localStorage.Tokens
  }
  return config
})

app.provide("axios", axios)
app.use(createPinia())
app.use(router)

app.use(ElementPlus, {
  locale: zhCn,
})
// 使用百度地图
app.use(BaiduMap, {
  ak: 'bXXLDppFNCOhnEZFFmWsJmb7QVpb6Byx'
})
// 使用组件
app.component('e-charts', Echarts)
// 全局挂载 echarts
app.config.globalProperties.$echarts = echarts
app.use(router).mount('#app')
//app.mount('#app')
